package com.ym.medical.enums;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.StdConverter;
import com.ym.common.annotations.EnumDescription;
import com.ym.common.constant.DictEnum;

/**
 * 支付状态
 */
@EnumDescription("支付状态")
public enum PaymentStateEnum implements DictEnum {

    //--------------------start-----------------

    /**
     * 待支付
     */
    TO_BE_PAID("01","待支付"),
    /**
     * 已支付
     */
    HAVE_TO_PAY("02","已支付"),
    /**
     * 退费申请中
     */
    THE_REFUND_APPLICATION("03","退费申请中"),
    /**
     * 已退费
     */
    HAVE_A_REFUND("04","已退费"),
    /**
     * 支付失败
     */
    PAY_FOR_FAILURE("05","支付失败"),
    /**
     * 退费失败
     */
    REFUND_FOR_FAILURE("06","退费失败"),

    //--------------------end-------------------
    ;

    //--------------------end-------------------
    private String key;

    private String value;

    PaymentStateEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    /**
     * 序列化使用
     */
    public static class Covert extends StdConverter<String, JSONObject> {
        @Override
        public JSONObject convert(String value) {
            return DictEnum.valueOfJson(PaymentStateEnum.class, value);
        }
    }
}
